package org.changneng.framework.frameworkbusiness.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.changneng.framework.frameworkbusiness.dao.EmployeeMapper;
import org.changneng.framework.frameworkbusiness.entity.Employee;
import org.changneng.framework.frameworkbusiness.entity.EmployeeExample;
import org.changneng.framework.frameworkbusiness.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class EmployeeServiceImpl implements EmployeeService {

    @Autowired
    private EmployeeMapper employeeMapper;
    @Override
    public int insert(Employee employee) {
        return employeeMapper.insert(employee);
    }

    @Override
    public List<Employee> Login(Employee employee) {
        EmployeeExample employeeExample = new EmployeeExample();
        employeeExample.createCriteria().andEmpidEqualTo(employee.getEmpid()).andPasswordEqualTo(employee.getPassword());
        return employeeMapper.selectByExample(employeeExample);
    }

    @Override
    public List<Employee> selectedp(String empid, String deptno, Integer onduty, String hiredate) {

        /*Page<Employee> page1 = PageHelper.startPage(page, size);*/
        List<Employee> list = employeeMapper.selectedp(empid, deptno, onduty, hiredate);

       /* PageInfo<Employee> pg = new PageInfo<Employee>();
        pg.setList(list);
        pg.setTotal(page1.getTotal());*/
        return  list;
    }
}
